<script setup lang="ts">


let { proList } = defineProps(['proList'])

import { getdetailFn } from '@/api/sort'
import { useRouter } from 'vue-router';
const router = useRouter()
import { ref } from 'vue'
import type { Ref } from 'vue'
const detailList: Ref<Array<string>> = ref([])

function gridClick(proid: string) {
    //写详情页面接口
    getdetailFn({ proid: proid }).then(res => {
        console.log(4, res.data);
        detailList.value = res.data
        console.log(8, detailList.value);
        localStorage.setItem('proid', res.data.proid)
        router.push({
            path: '/detail/' + res.data.proid,
            query: { proid:proid },
            // query: { proid: res.data.proid },

        })
    })
}
</script>
<template>
    <div>
        <van-card v-for="item in proList" :price="(item.originprice * item.discount * 0.1).toFixed(2)" :desc="item.desc" :title="item.proname"
            :key="item.proid" :thumb="item.img1" @click="gridClick(item.proid)" />
    </div>
</template>